#ifndef INCLUDED_MAP_H
#define INCLUDED_MAP_H

#include <SGE.h>
using namespace SGE;

class Map
{
	public:
		Map();
		~Map();

		void Load(const char* pLevel, const char* pTexturePack);
		void Unload();
		void Update(float deltaTime);
		void Render(const SVector2& viewOffset);

		bool TestCollision(const SLineSegment& segment, SRect& rect) const;

		int GetWidth() const	{ return mColumns * mTileSize; }
		int GetHeight() const	{ return mRows * mTileSize; }

	private:
		bool LoadLevel(const char* pLevel);
		bool LoadTexturePack(const char* pTexturePack);

		int GetIndex(int x, int y) const; //smart indexing
		bool IsBlocked(int x, int y) const;
		SRect GetBoundingBox(int x, int y) const;

		SGE_Sprite* mpSprites; //array of sprite types
		int* mpTiles; //pointer to array
		
		int mNumSprites;
		int mTileSize; //dimensions
		int mColumns; 
		int mRows;
};

#endif // #ifndef INCLUDED_MAP_H